
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="../css/popup.css"/>  
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jq.date.js"></script>
        <link rel="stylesheet" type="text/css" href="../css/ui.datepicker.css"/>

        <link rel="stylesheet" type="text/css" href="../css/kapiform.css"/>
        <style type="text/css">
            #ui-datepicker-div
            {
                z-index: 9999999;
            }

        </style>

        <script type="text/javascript">
            var open_cur = 0;
            $j = jQuery.noConflict();
            $j(document).ready(function(){
             $j("#date").attr('readonly', 'readonly');
             
                $j('input#date').datepicker({ 
                    dateFormat: "dd/mm/yy", showOn: 'button', buttonImage: '../images/calenda_icon.gif', buttonImageOnly: true });         
 
                
                $j(".userLogin").live("keyup",function(){
                   $j('.sumbitEmp').attr('disabled', false);    
                });
                $j(".userLogin").live("change",function(){
                        
                    userLogin = $j(".userLogin").val();
                    // alert(userLogin);
                    var result= $j.ajax({
                        url: "checkLogin.jsp",
                        global: false,
                        data:"action=checkLogin&username="+userLogin,
                        dataType: "html",
                        async:false,
                        success: function(msg){
                            
                        }
                    }
                    
                ).responseText;
                     
                    if(result!=0){
                        $j('.sumbitEmp').attr('disabled', true);
                        $j(".alert").text("Xin vui long kiểm tra lại tên đăng nhập");
                   

                    }else{
                        $j('.sumbitEmp').attr('disabled', false);               
                        $j(".alert").text("");
                     
                     
                    }
                      
                
                });
                validateform("emp-input-form");

            });           

        </script>

    </head>
    <body style=" float:left; width:auto; height:auto; margin:0px;">
        <f:view>
            <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
            <a4j:form id="emp-input-form">
                <div class="popup" style="height:330px; width:398px">
                    <div class="popup-header">
                        <div class="title"><h:outputText value="#{locale.update_employee}" styleClass="addEmployee"/></div>
                    </div>
                    <div class="popup-content">
                        <div class="main_content">
                            <!-- Start Insert Information basic Employee 19/05/2012-->
                            <div class="form_item_content" style="display: block;">
                               
                                <div class="fields_input">
                                    <label><h:outputText value="#{locale.fname}"  /> *: </label>
                                    <h:inputText value="#{EmpBean.nv102}" id="firstname" styleClass="required "/> 
                                </div>
                                <div class="fields_input">
                                    <label><h:outputText value="#{locale.lname}"/> *: </label>                                          
                                    <h:inputText value="#{EmpBean.nv103}" id="lastname" lang="firstname" styleClass="required"  />   
                                </div>
                                <div class="fields_input">
                                    <label><h:outputText value="Tên đăng nhập"/> *: </label>                                          
                                    <h:inputText value="#{EmpBean.nv106}" id="tdn" lang="tdn" styleClass="userLogin required" readonly="#{EmpBean.flag}"  />   
                                </div>                                                           
                                <div class="fields_input">
                                    <label> <h:outputText value="#{locale.sex}"/> *:</label>
                                    <h:selectOneRadio value="#{EmpBean.sexChangeItem}" id="sex" styleClass="feild_sex" >
                                        <f:selectItem itemValue="M" itemLabel="#{locale.employeeSexMale}"/>
                                        <f:selectItem itemValue="F" itemLabel="#{locale.employeeSexFmale}"/>                                           
                                    </h:selectOneRadio>                                               
                                </div>

                                <div class="fields_input">

                                    <label><h:outputText value="#{locale.dateBorn}"/> *:</label>
                                    <input value="<h:outputText value="#{EmpBean.dateBorn}"><f:convertDateTime pattern="#{loginSession.login.qv116}"/></h:outputText>" type="text" id="date" name="date" class="required date" />
                                    </div>
                                    <div class="fields_input">
                                        <label > <h:outputText value="#{locale.status_family}"/>:</label>
                                    <h:selectOneMenu value="#{EmpBean.status_family}" styleClass="status" >                                           
                                        <f:selectItem itemLabel="#{locale.status_family_true}" itemValue="1" />
                                        <f:selectItem itemLabel="#{locale.status_family_false}" itemValue="2" />
                                        <f:selectItem itemLabel="#{locale.status_family_orther}" itemValue="3" />
                                    </h:selectOneMenu>
                                    <h:inputHidden id="FFN600" value="#{EmpBean.FN600}" />
                                    <h:inputHidden id="FK100" value="#{EmpBean.fk100}" />
                                </div>
                                <div class="alert">

                                </div>
                            </div>
                            <!--  End Insert Information basic Employee 19/05/2012-->

                        </div>

                    </div>
                    <div class="popup-footer">

                        <div class="buttonsave" onclick="jQuery.fancybox.close(); "  ><span><h:outputText value="#{locale.close}" /></span></div>
                        <h:commandButton id="sumbitEmp"  onclick="return validatecheck('emp-input-form');"  action="#{EmpBean.saveEmployee}" value="#{locale.save}" styleClass="buttonsave sumbitEmp" >
                            <f:param value="#{EmpBean.pn100}" name="pn100Edit"/>
                            <f:param value="editEmployee" name="action"/>
                        </h:commandButton>
                        <h:inputHidden value="#{EmpBean.flag}" id="flag" />                  
                        <h:inputHidden value="#{EmpBean.flagCheckLogin}" id="flagCheckLogin" /> 
                        <h:inputHidden value="#{EmpBean.pn100}" id="pn100A" />
                    </div>
                </div>
            </a4j:form>
        </f:view>
    </body>
</html>
<script type="text/javascript">
    $j(document).ready(function(){
        yhight = ($j('.popup').height()-90)+"px" ;
        $j('.main_content').css('height',yhight );
        $j('.popup-content').css('height',yhight );
    });
</script>